package com.wz.project.rkk.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.project.rkk.domain.MsgSsjRkk;
import com.wz.project.rkk.service.IMsgSsjRkkService;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * 提升机前Controller
 * 
 * @author wz
 * @date 2024-01-09
 */
@Controller
@RequestMapping("/rkk/rkk")
public class MsgSsjRkkController extends BaseController
{
    private String prefix = "rkk/rkk";

    @Autowired
    private IMsgSsjRkkService msgSsjRkkService;

    @RequiresPermissions("rkk:rkk:view")
    @GetMapping()
    public String rkk()
    {
        return prefix + "/rkk";
    }

    /**
     * 查询提升机前列表
     */
//    @RequiresPermissions("rkk:rkk:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(MsgSsjRkk msgSsjRkk)
    {
        startPage();
        List<MsgSsjRkk> list = msgSsjRkkService.selectMsgSsjRkkList(msgSsjRkk);
        return getDataTable(list);
    }

    /**
     * 导出提升机前列表
     */
    @RequiresPermissions("rkk:rkk:export")
    @Log(title = "提升机前", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MsgSsjRkk msgSsjRkk)
    {
        List<MsgSsjRkk> list = msgSsjRkkService.selectMsgSsjRkkList(msgSsjRkk);
        ExcelUtil<MsgSsjRkk> util = new ExcelUtil<MsgSsjRkk>(MsgSsjRkk.class);
        return util.exportExcel(list, "rkk");
    }

    /**
     * 新增提升机前
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存提升机前
     */
    @RequiresPermissions("rkk:rkk:add")
    @Log(title = "提升机前", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(MsgSsjRkk msgSsjRkk)
    {
        return toAjax(msgSsjRkkService.insertMsgSsjRkk(msgSsjRkk));
    }

    /**
     * 修改提升机前
     */
    @GetMapping("/edit/{devId}")
    public String edit(@PathVariable("devId") String devId, ModelMap mmap)
    {
        MsgSsjRkk msgSsjRkk = msgSsjRkkService.selectMsgSsjRkkById(devId);
        mmap.put("msgSsjRkk", msgSsjRkk);
        return prefix + "/edit";
    }

    /**
     * 修改保存提升机前
     */
    @RequiresPermissions("rkk:rkk:edit")
    @Log(title = "提升机前", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(MsgSsjRkk msgSsjRkk)
    {
        return toAjax(msgSsjRkkService.updateMsgSsjRkk(msgSsjRkk));
    }

    /**
     * 删除提升机前
     */
    @RequiresPermissions("rkk:rkk:remove")
    @Log(title = "提升机前", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(msgSsjRkkService.deleteMsgSsjRkkByIds(ids));
    }
}
